package com.galen.wxRead.utils;

import java.math.BigDecimal;

public class MoneyUtil {
    public static final String CURRENCY_FEN_REGEX = "\\-?[0-9]+";

    //分转元
    public static BigDecimal fen2Yuan(String amount) {
        if (!amount.matches(CURRENCY_FEN_REGEX)) {
            throw new RuntimeException("金额格式错误|" + amount);
        }
        return BigDecimal.valueOf(Long.valueOf(amount)).divide(new BigDecimal(100));
    }


}
